]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
search-display: Try harder to use a correct drag actor source
authorFlorian Müllner <fmuellner@gnome.org>
Fri, 20 May 2011 11:57:38 +0000 (13:57 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Tue, 21 Jun 2011 20:23:00 +0000 (22:23 +0200)
Commit 429f809b7 fixed an exception in getDragActorSource(), but
the returned actor is only an approximation (e.g. in contrast to
the actual drag actor, it includes the label).
Try a bit harder to return the correct actor and only fall back to
the approximation when necessary.

https://bugzilla.gnome.org/show_bug.cgi?id=645990

js/ui/searchDisplay.js

index fdf918f3e6d67a4137e196a73555ac7234cd18b0..bdaa59c8d42fc32f0a2c1499bf1c0eb85245870f 100644 (file)
@@ -28,6 +28,7 @@ SearchResult.prototype = {
                                      x_align: St.Align.START,
                                      y_fill: true });
         this.actor._delegate = this;
+        this._dragActorSource = null;
 
         let content = provider.createResultActor(metaInfo, terms);
         if (content == null) {
@@ -37,7 +38,11 @@ SearchResult.prototype = {
             let icon = new IconGrid.BaseIcon(this.metaInfo['name'],
                                              { createIcon: this.metaInfo['createIcon'] });
             content.set_child(icon.actor);
+            this._dragActorSource = icon.icon;
             this.actor.label_actor = icon.label;
+        } else {
+            if (content._delegate && content._delegate.getDragActorSource)
+                this._dragActorSource = content._delegate.getDragActorSource();
         }
         this._content = content;
         this.actor.set_child(content);
@@ -76,6 +81,8 @@ SearchResult.prototype = {
     },
 
     getDragActorSource: function() {
+        if (this._dragActorSource)
+            return this._dragActorSource;
         // not exactly right, but alignment problems are hard to notice
         return this._content;
     },